﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vds2465Telegrams
{
    public enum eReportSubType_Disruption
    {
        General,
        PrimaryLine,
        Network,
        Battery,
        TransmissionPath,
        GroundFault,
        Test,
        EnergySupply,
        BufferOverflow,
        NotSentMessages,
        TransmissionPath_1,
        TransmissionPath_2,
    }

    public class ReportType_Disruption : ReportType_Base
    {
        #region private member variables

        private eReportSubType_Disruption _reportSubTypeDisruption;

        #endregion private member variables

        #region constructor

        public ReportType_Disruption(bool onOffFlag, eReportSubType_Disruption reportSubTypeDisruption)
            : base(onOffFlag)
        {
            _reportSubTypeDisruption = reportSubTypeDisruption;
        }

        #endregion constructor

        #region getters

        public eReportSubType_Disruption ReportSubType { get { return _reportSubTypeDisruption; } }

        #endregion getters

        #region ToString, Equals, GetHashCode

        public override int GetHashCode()
        {
            int hashCode = base.GetHashCode();
            hashCode ^= (byte)ReportSubType;

            return hashCode;
        }

        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("(");
            stringBuilder.Append(ToStringProperties());
            stringBuilder.Append(")");

            return stringBuilder.ToString();
        }

        internal override string ToStringProperties()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.ToStringProperties());

            stringBuilder.Append(", ");

            stringBuilder.Append("ReportSubType='");
            stringBuilder.Append(ReportSubType);
            stringBuilder.Append("'");

            return stringBuilder.ToString();
        }

        public override bool Equals(object obj)
        {
            Type objType = obj.GetType();
            if (this.GetType() == objType)
            {
                ReportType_Disruption reportTypeDisruption2Compare = obj as ReportType_Disruption;
                return EqualsProperties(reportTypeDisruption2Compare);
            }

            return false;
        }

        internal bool EqualsProperties(ReportType_Disruption reportTypeDisruption2Compare)
        {
            if (base.EqualsProperties(reportTypeDisruption2Compare))
            {
                return (ReportSubType == reportTypeDisruption2Compare.ReportSubType);
            }

            return false;
        }

        #endregion ToString, Equals, GetHashCode
    }    
}
